home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / libx11 / include / x11 / xmu / xct.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  6KB  |  159 lines

  1. #ifndef _Xct_h
  2. #define _Xct_h
  3.  
  4. /* 
  5.  * $XConsortium: Xct.h,v 1.6 91/07/22 23:46:25 converse Exp $
  6.  * Copyright 1989 by the Massachusetts Institute of Technology
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted, provided 
  10.  * that the above copyright notice appear in all copies and that both that 
  11.  * copyright notice and this permission notice appear in supporting 
  12.  * documentation, and that the name of M.I.T. not be used in advertising
  13.  * or publicity pertaining to distribution of the software without specific, 
  14.  * written prior permission. M.I.T. makes no representations about the 
  15.  * suitability of this software for any purpose.  It is provided "as is"
  16.  * without express or implied warranty.
  17.  */
  18.  
  19. #include <X11/Xfuncproto.h>
  20.  
  21. #define XctVersion 1
  22.  
  23. typedef unsigned char *XctString;
  24.  
  25. typedef enum {
  26.     XctUnspecified,
  27.     XctLeftToRight,
  28.     XctRightToLeft
  29. } XctHDirection;
  30.  
  31. typedef unsigned long XctFlags;
  32.  
  33. /* These are bits in XctFlags. */
  34.  
  35. #define XctSingleSetSegments    0x0001
  36.    /* This means that returned segments should contain characters from only
  37.     * one set (C0, C1, GL, GR).  When this is requested, XctSegment is never
  38.     * returned, instead XctC0Segment, XctC1Segment, XctGlSegment, and
  39.     * XctGRSegment are returned.  C0 and C1 segments are always returned as
  40.     * singleton characters.
  41.     */
  42.  
  43. #define XctProvideExtensions    0x0002
  44.    /* This means that if the Compound Text string is from a higher version
  45.     * than this code is implemented to, then syntactically correct but unknown
  46.     * control sequences should be returned as XctExtension items.  If this
  47.     * flag is not set, and the Compound Text string version indicates that
  48.     * extensions cannot be ignored, then each unknown control sequence will be
  49.     * reported as an XctError.
  50.     */
  51.  
  52. #define XctAcceptC0Extensions    0x0004
  53.    /* This means that if the Compound Text string is from a higher version
  54.     * than this code is implemented to, then unknown C0 characters should be
  55.     * treated as if they were legal, and returned as C0 characters (regardless
  56.     * of how XctProvideExtensions is set).  If this flag is not set, then all
  57.     * unknown C0 characters are treated according to XctProvideExtensions.
  58.     */
  59.  
  60. #define XctAcceptC1Extensions    0x0008
  61.    /* This means that if the Compound Text string is from a higher version
  62.     * than this code is implemented to, then unknown C0 characters should be
  63.     * treated as if they were legal, and returned as C0 characters (regardless
  64.     * of how XctProvideExtensions is set).  If this flag is not set, then all
  65.     * unknown C0 characters are treated according to XctProvideExtensions.
  66.     */
  67.  
  68. #define XctHideDirection    0x0010
  69.    /* This means that horizontal direction changes should be reported as
  70.     * XctHorizontal items.  If this flag is not set, then direction changes are
  71.     * not returned as items, but the current direction is still maintained and
  72.     * reported for other items.
  73.     */
  74.  
  75. #define XctFreeString        0x0020
  76.    /* This means that XctFree should free the Compound Text string (that was
  77.     * passed to XctCreate.  If this flag is not set, the string is not freed.
  78.     */
  79.  
  80. #define XctShiftMultiGRToGL    0x0040
  81.    /* Translate GR segments on-the-fly into GL segments for the GR sets:
  82.     * GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.
  83.     */
  84.  
  85. /* This is the return type for XctNextItem. */
  86. typedef enum {
  87.     XctSegment,        /* used when XctSingleSetSegments is not requested */
  88.     XctC0Segment,    /* used when XctSingleSetSegments is requested */
  89.     XctGLSegment,    /* used when XctSingleSetSegments is requested */
  90.     XctC1Segment,    /* used when XctSingleSetSegments is requested */
  91.     XctGRSegment,    /* used when XctSingleSetSegments is requested */
  92.     XctExtendedSegment,    /* an extended segment */
  93.     XctExtension,    /* used when XctProvideExtensions is requested */
  94.     XctHorizontal,    /* horizontal direction or depth change */
  95.     XctEndOfText,    /* end of text string */
  96.     XctError        /* syntactic or semantic error */
  97. } XctResult;
  98.  
  99. typedef struct _XctRec {
  100.     XctString        total_string;    /* as given to XctCreate */
  101.     int            total_length;    /* as given to XctCreate */
  102.     XctFlags        flags;        /* as given to XctCreate */
  103.     int            version;    /* indicates the version of the CT spec
  104.                      * the string was produced from */
  105.     int            can_ignore_exts;/* non-zero if ignoring extensions is
  106.                      * acceptable, else zero */
  107.     XctString        item;        /* item returned from XctNextItem */
  108.     int            item_length;    /* length of item in bytes */
  109.     int            char_size;    /* number of bytes per character in
  110.                      * item, with zero meaning variable */
  111.     char        *encoding;    /* Encoding name for item */
  112.     XctHDirection    horizontal;    /* direction of item */
  113.     int            horz_depth;    /* current direction nesting depth */
  114.     char        *GL;        /* "{I} F" string for current GL */
  115.     char        *GL_encoding;    /* Encoding name for current GL */
  116.     int            GL_set_size;    /* 94 or 96 */
  117.     int            GL_char_size;    /* number of bytes per GL character */
  118.     char        *GR;        /* "{I} F" string for current GR */
  119.     char        *GR_encoding;    /* Encoding name for current GR */
  120.     int            GR_set_size;    /* 94 or 96 */
  121.     int            GR_char_size;    /* number of bytes per GR character */
  122.     char        *GLGR_encoding;    /* Encoding name for current GL+GR,
  123.                      * if known */
  124.     struct _XctPriv    *priv;        /* private to parser, don't peek */
  125. } *XctData;
  126.  
  127. /* these are the external routines */
  128. _XFUNCPROTOBEGIN
  129.  
  130. extern XctData XctCreate(
  131. #if NeedFunctionPrototypes
  132.     _Xconst unsigned char *    /* string */,
  133.     int            /* length */,
  134.     XctFlags        /* flags */
  135. #endif
  136. );
  137.  
  138. extern XctResult XctNextItem(
  139. #if NeedFunctionPrototypes
  140.     XctData    /* data */
  141. #endif
  142. );
  143.  
  144. extern void XctFree(
  145. #if NeedFunctionPrototypes
  146.     XctData    /* data */
  147. #endif
  148. );
  149.  
  150. extern void XctReset(
  151. #if NeedFunctionPrototypes
  152.     XctData    /* data */
  153. #endif
  154. );
  155.  
  156. _XFUNCPROTOEND
  157.  
  158. #endif /* _Xct_h */
  159.